﻿using System;
using System.Collections.Generic;
using OpenTK;


namespace AirHockey
{
    public class Mesh
    {
        #region Members
        public int vbo;
        public VertexInterleaved[] vertices;
        #endregion

        #region Constructor
        public Mesh(List<Face> faces)
        {
            vertices = new VertexInterleaved[faces.Count * 3];

            int currentVertex = 0;

            foreach (Face face in faces)
            {
                for (int i = 0; i < 3; i++)
                {
                    VertexInterleaved v = new VertexInterleaved();
                    v.Position = new Vector4(face.Vertices[i],1);
                    v.Normal = face.Normals[i];
                    v.TextureCoordinate = face.Uvs[i];
                    vertices[currentVertex] = v;
                    currentVertex++;
                }
            }
        }
        #endregion
    }
}
